#include "mainwindow.h"
//场景
#include <QGraphicsScene>
//摄像机
#include <QGraphicsView>
#include <QApplication>
#include <QIcon>
#include <GameSetting.h>
#include <player.h>
#include "score.h"
#include "health.h"
#include <QtMultimedia>
// #include <Qurl>
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    a.setApplicationDisplayName("飞机大战");
    QApplication::setWindowIcon(QIcon(":/image/BackGround2.png"));
    //创建分数文字
    //创建player
    Player* player = new Player;
    //创建场景
    QGraphicsScene *scene=new QGraphicsScene;
    scene->addItem(player);
    scene->setSceneRect(0,0,GameSetting::SceneWidth,GameSetting::SceneHeight);
    scene->setBackgroundBrush(QImage(":/image/BackGround2.png"));
    //创建分数文字
    scene->addItem(&Score::getInstance());
    //创建健康值文字
    scene->addItem(&Health::getInstance());
    //场景挂在摄像机（视图）上
    QGraphicsView view(scene);
    view.setFixedSize(GameSetting::SceneWidth,GameSetting::SceneHeight);
    //去除滚轮条 水平  垂直
    view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view.show();
    //添加背景音乐
    QMediaPlayer bgMusic;
    QAudioOutput audioOutput;
    bgMusic.setAudioOutput(&audioOutput);
    bgMusic.setSource(QUrl("qrc:/sounds/bgsound.mp3"));
    bgMusic.play();
    return a.exec();
}
